import React from 'react';
import ProForm, {ProFormRadio, ProFormText} from "@ant-design/pro-form";
import {Form, message, Modal} from "antd";
import {subscription_xg} from "@/services/ant-design-pro/management";

const BianjiWeChat = (props) => {
  const {isBianji,isBianjiData,isMyUid,Formlist} = props
  const [form] = Form.useForm()
  return (
    <Modal
      visible={isBianji}
      onCancel={() => {
        isBianjiData(false)
      }}
      footer={false}
    >
      <ProForm
        form={form}
        visible={isBianji}
        onCancel={() => {isBianjiData(false)}}
        modalProps={ {
          onCancel:() => {isBianjiData(false)}
        } }
        title="小程序订阅消息"
        onFinish={async (values) => {
          message.success('添加成功');
          subscription_xg( isMyUid.id , {
            template_id:values.template_id,
            status:values.status
          })
          Formlist(values)
          return isBianjiData(false);
        }}
      >
        <ProFormText
          name="1"
          label="模板编号："
          initialValue={isMyUid.content}
          disabled={true}
        />
        <ProFormText
          name="name"
          label="模板名："
          initialValue={isMyUid.name}
          disabled={true}
        />
        <ProFormText
          name="template_id"
          label="模板ID："
          initialValue={isMyUid.template_id}
        />
        <ProFormRadio.Group
          name="status"
          label="状态:"
          initialValue={isMyUid.status}
          options={[
            {
              label: '开启',
              value: 1,
            },
            {
              label: '关闭',
              value: 2,
            },
          ]}
        />
      </ProForm>
    </Modal>
  );
};

export default BianjiWeChat;
